# from pyecharts import Line
#
# line = Line("折线图", "比特币的价格走势")
# data1 = [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
# # is_label_show 设置上方数据是否展示
# line.add("价格", columns, data1, is_label_show = True)
#
# line.render()

from pyecharts.charts import Bar
from pyecharts import options as opts
from pyecharts.render import make_snapshot
# 使用 snapshot_selenium渲染图片
# from snapshot_selenium import snapshot
from pyecharts.globals import ThemeType
import random
bar = Bar()
# 横坐标
init_opts = opts.InitOpts(theme=ThemeType.LIGHT)  # 初始化配置项
bar.add_xaxis(["比特币", "柚子", "以太坊", "莱特币", "火币积分", "瑞波币"])
# bar.add_xaxis(["比特币", "柚子", "以太坊", "莱特币", "火币积分", "瑞波币"])
# 纵坐标
bar.add_yaxis("价格", [random.randint(10, 100) for _ in range(100)])
# bar.add_yaxis("价格", [5, 20, 36, 10, 75, 90])
# 需要设置主标题和副标题
bar.set_global_opts(title_opts=opts.TitleOpts(title="比特币", subtitle="价格"))
# 或者直接使用字典
# bar.set_global_opts(title_opts={"text": "主标题", "subtext": "副标题"})
# render 会生成本地 HTML 文件，默认会在当前目录生成 render.html 文件
# 也可以传入路径参数，如 bar.render("mycharts.html")
# bar.render会生成一个网站
# make_snapshot(snapshot, bar.render(), r"C:\Users\PC\Desktop\问题.jpg")
bar.render("比特币.html")
